#ifndef LONGKEY_BASE_WINDOW_UTILS_H_
#define LONGKEY_BASE_WINDOW_UTILS_H_

#include <atlcoll.h>
#include "basictypes.h"

// Flags for window requirements
const uint32 kWindowMustBeTopLevel	= 0x00000001;
const uint32 kWindowMustHaveSysMenu	= 0x00000002;
const uint32 kWindowMustBeVisible	= 0x00000004;

class WindowUtils
{
public:
	// Finds all the primary windows owned by the given process. For the
	// purposes of this function, primary windows are top-level, have a system
	// menu, and are visible.
	static bool FindProcessWindows(uint32 process_id, 
		uint32 window_flags,
		CSimpleArray<HWND>* windows);

	// Forces the window to the foreground.
	static void MakeWindowForeground(HWND wnd);

	// Returns true if the window is the "main window" of a process:
	// if it's Visible, and Top Level
	static bool IsMainWindow(HWND wnd);

	// Returns true if the window has a System Menu
	static bool HasSystemMenu(HWND wnd);

	// Sets a window's icon to the specified icon embedded within the running exe
	// module.
	static HRESULT SetWindowIcon(HWND hwnd, WORD icon_id, HICON* hicon);

private:
	DISALLOW_IMPLICIT_CONSTRUCTORS(WindowUtils);
};

#endif	// LONGKEY_BASE_WINDOW_UTILS_H_